/**
 * Created by baiguiren on 1/16/17.
 */


let async = require('async');

let test_arr = [1, 2, 3, 4, 5];

async.reject(test_arr, (item, callback) => {
  setTimeout(() => {
    callback(null, item >= 3);
  }, Math.random() * 100);
}, (err, results) => {
  console.log(err? err : results);
});

async.filter(test_arr, (item, callback) => {
  setTimeout(() => {
    callback(null, item >= 3);
  }, Math.random() * 100);
}, (err, results) => {
  console.log(err ? err : results);
});

async.rejectLimit(test_arr, 2, (item, callback) => {
  setTimeout(() => {
    callback(null, item >= 3);
  }, Math.random() * 100);
}, (err, results) => {
  console.log(err ? err : results);
});

async.rejectSeries(test_arr, (item, callback) => {
  setTimeout(() => {
    callback(null, item >= 3);
  }, Math.random() * 100);
}, (err, results) => {
  console.log(err ? err : results)
});
